<template>
	<!-- 美容美发 -->
	<view>
		<view class="tab">
			<scroll-view scroll-x class="bg-white nav" scroll-with-animation :scroll-left="scrollLeft">
				<view class="cu-item" :class="index==TabCur?'text-green ':''" v-for="(item,index) in tab" :key="index" @tap="tabSelect" :data-id="index">
					{{item}}
				</view>
			</scroll-view>
		</view>
		<view class="list">
			<view v-for="(item,index) in 6" :key="index" class="item flex" @click="handlelist(item)">
				<image src="/static/矩形 29.png" mode=""></image>
				<view class="text_div">
						<view class="food_name flex-cb">
							<text>沐颜造型（花果园店）</text>
							<text class="state" :class="{state1:index%2 == 0}">营业中</text>
						</view>
						<view class="score">
								<text class="cuIcon-favorfill"></text>
								<text class="num">4.6</text>
								<text class="time">营业时间：10:00</text>
						</view>
						<view class="phone">联系电话：12345678901</view>
						<view class="address">地址：贵州省贵阳市花果园金融街5号2...</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				TabCur: 0,
				scrollLeft: 0,
				tab:['全部','美发','美甲美瞳','韩式定妆','瑜伽舞蹈','医学美容']
			};
		},
		onLoad(){
		},
		methods:{
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
				if(this.TabCur != 0){
					uni.setNavigationBarTitle({
						title:this.tab[this.TabCur]
					})
				}else{
					uni.setNavigationBarTitle({
						title:'美容美发'
					})
				}
			},
			handlelist(){
				uni.navigateTo({
					url:'../meifa_datails',
					fail(e) {
						console.log(e)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
.tab{
	margin-top: 18rpx;
	font-size: 28rpx;
	.text-green{
		font-size: 30rpx;
		font-weight: bold;
	}
}
.list{
	padding: 20rpx;
	.item{
		width: 710rpx;
		height: 260rpx;
		padding: 28rpx 22rpx 24rpx 20rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		image{
			width: 208rpx;height: 208rpx;border-radius: 10rpx;
		}
		.text_div{
			margin-left: 14rpx;
			.food_name{
				font-size: 32rpx;
				color: #333;
				.state{
					color: #1CD699;
				}
				.state1{
					color: #999999;
				}
			}
			.score{
				margin-top: 8rpx;
				margin-bottom: 14rpx;
				text{
					color: #FF6F10;
				}
				.cuIcon-favorfill,.num{
					font-size: 26rpx;
				}
			}
			.phone,.address{
				font-size: 24rpx;
				color: #999999;
			}
			.address{
				margin-top: 20rpx;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
		}
	}
}
</style>
